********************************************
**** GLES Short-term Campaign Panel 2013
********************************************

use "SET_YOUR_PATH_FOR_INPUT\ZA5704_v3-2-0.dta", clear


**************************
*** Recode variables
**************************



**************************
*** socio-economic problems
**************************

*personal financial situation
mvdecode  kp1_780 kp4_780 kp7_780, mv(-99/-1)

rev kp1_780, gen(ewl_2013_1)
rev kp4_780, gen(ewl_2013_4)
rev kp7_780, gen(ewl_2013_7)

fre ewl_2013_1-ewl_2013_7

pwcorr  ewl_2013_1-ewl_2013_7

*net household income
mvdecode kpx_2591, mv(-99/-1)
clonevar income_2013 = kpx_2591


**************************
*** Political Knowledge
**************************
/* Variables 
kp1_3440 kp1_3430a kp1_3430b kp1_3430c kp1_3430d kp1_3430e kp1_3430f  ///
kp2_090 kp2_110 kp2_130 kp2_3430j kp2_3430k kp2_3430l kp2_3430m kp2_3430n kp2_3430o   ///
kp3_3430a kp3_3430b kp3_3430c kp3_3430d kp3_3430e kp3_3430f  ///
kp4_110 kp4_130 kp4_3430j kp4_3430k kp4_3430l kp4_3430m kp4_3430n kp4_3430o kp4_3440 ///
kp5_090  ///
kp6_090 kp6_110 kp6_130 kp6_3430j kp6_3430k kp6_3430l kp6_3430m kp6_3430n kp6_3430o  ///
kp7_090 kp7_110 kp7_130 kp7_3430a kp7_3430b kp7_3430c kp7_3430d kp7_3430e kp7_3430f*/


*Political Knowledge: 5% clause
foreach var of varlist kp2_090_v1 kp5_090_v1 kp6_090_v1 kp7_090_v1 {
	recode `var' (1=1 "richtig")(0 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}
clonevar wissen1_2013_2 = kp2_090_v1_r
clonevar wissen1_2013_5 = kp5_090_v1_r
clonevar wissen1_2013_6 = kp6_090_v1_r
clonevar wissen1_2013_7 = kp7_090_v1_r

*Political Knowledge: first and second vote
foreach var of varlist kp2_110 kp4_110 kp6_110 kp7_110 {
	recode `var' (2=1 "richtig")(1 3 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}
clonevar wissen2_2013_2 = kp2_110_r
clonevar wissen2_2013_4 = kp4_110_r
clonevar wissen2_2013_6 = kp6_110_r
clonevar wissen2_2013_7 = kp7_110_r

*Political Knowledge: voting law in Germany
foreach var of varlist kp2_130 kp4_130 kp6_130 kp7_130 {
	recode `var' (3=1 "richtig")(1 2 4 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}
clonevar wissen3_2013_2 = kp2_130_r
clonevar wissen3_2013_4 = kp4_130_r
clonevar wissen3_2013_6 = kp6_130_r
clonevar wissen3_2013_7 = kp7_130_r

*Political Knowledge: unemployment rate
foreach var of varlist kp1_3440 kp4_3440 kp7_3440 {
	recode `var' (2=1 "richtig")(1 3 4 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}
clonevar wissen4_2013_1 = kp1_3440_r
clonevar wissen4_2013_4 = kp4_3440_r
clonevar wissen4_2013_7 = kp7_3440_r

	
*** Pictures

***Variant 1:

*Angela Merkel
foreach var of varlist kp1_3430a kp3_3430a kp7_3430a {
	recode `var' (2=1 "richtig")(3/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen5_2013_1 = kp1_3430a_r
clonevar wissen5_2013_3 = kp3_3430a_r
clonevar wissen5_2013_7 = kp7_3430a_r

*Peer Steinbrueck
foreach var of varlist kp1_3430b kp3_3430b kp7_3430b {
	recode `var' (4=1 "richtig")(2 3 5/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen6_2013_1 = kp1_3430b_r
clonevar wissen6_2013_3 = kp3_3430b_r
clonevar wissen6_2013_7 = kp7_3430b_r

*Horst Seehofer
foreach var of varlist kp1_3430c kp3_3430c kp7_3430c {
	recode `var' (3=1 "richtig")(1 2 4/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen7_2013_1 = kp1_3430c_r
clonevar wissen7_2013_3 = kp3_3430c_r
clonevar wissen7_2013_7 = kp7_3430c_r

*Rainer Bruederle
foreach var of varlist kp1_3430d kp3_3430d kp7_3430d {
	recode `var' (5=1 "richtig")(2/4 6/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen8_2013_1 = kp1_3430d_r
clonevar wissen8_2013_3 = kp3_3430d_r
clonevar wissen8_2013_7 = kp7_3430d_r

*Juergen Trittin
foreach var of varlist kp1_3430e kp3_3430e kp7_3430e {
	recode `var' (6=1 "richtig")(2/5 7/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}				
clonevar wissen9_2013_1 = kp1_3430e_r
clonevar wissen9_2013_3 = kp3_3430e_r
clonevar wissen9_2013_7 = kp7_3430e_r

*Gregor Gysi
foreach var of varlist kp1_3430f kp3_3430f kp7_3430f {
	recode `var' (7=1 "richtig")(2/6 215 322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}		
clonevar wissen10_2013_1 = kp1_3430f_r
clonevar wissen10_2013_3 = kp3_3430f_r
clonevar wissen10_2013_7 = kp7_3430f_r

	
	
	
	
***Variant 2:
*Sigmar Gabriel
foreach var of varlist kp2_3430j kp4_3430j kp6_3430j {
	recode `var' (4=1 "richtig")(2 3 5/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen11_2013_2 = kp2_3430j_r
clonevar wissen11_2013_4 = kp4_3430j_r
clonevar wissen11_2013_6 = kp6_3430j_r

*Philipp Roesler
foreach var of varlist kp2_3430k kp4_3430k kp6_3430k {
	recode `var' (5=1 "richtig")(2 3 4 6/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen12_2013_2 = kp2_3430k_r
clonevar wissen12_2013_4 = kp4_3430k_r
clonevar wissen12_2013_6 = kp6_3430k_r

*Katrin Goering-Eckardt
foreach var of varlist kp2_3430l kp4_3430l kp6_3430l {
	recode `var' (6=1 "richtig")(2/5 7 322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen13_2013_2 = kp2_3430l_r
clonevar wissen13_2013_4 = kp4_3430l_r
clonevar wissen13_2013_6 = kp6_3430l_r

*Sahra Wagenknecht
foreach var of varlist kp2_3430m kp4_3430m kp6_3430m {
	recode `var' (7=1 "richtig")(2/6 7/322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}	
clonevar wissen14_2013_2 = kp2_3430m_r
clonevar wissen14_2013_4 = kp4_3430m_r
clonevar wissen14_2013_6 = kp6_3430m_r

*Bernd Schloemer
foreach var of varlist kp2_3430n kp4_3430n kp6_3430n {
	recode `var' (215=1 "richtig")(2/7 322 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}				
clonevar wissen15_2013_2 = kp2_3430n_r
clonevar wissen15_2013_4 = kp4_3430n_r
clonevar wissen15_2013_6 = kp6_3430n_r

*Bernd Lucke
foreach var of varlist kp2_3430o kp4_3430o kp6_3430o {
	recode `var' (322=1 "richtig")(1/215 -98 -99=0 "falsch")(else=.), gen(`var'_r)
	}		
clonevar wissen16_2013_2 = kp2_3430o_r
clonevar wissen16_2013_4 = kp4_3430o_r
clonevar wissen16_2013_6 = kp6_3430o_r	
	
	
	
	
*********************************************
*** Indices for political knowledge *********
*********************************************

* Verbal knowledge: waves 2, 6, 7
gen wissen_verb_2013_2 = wissen1_2013_2 + wissen2_2013_2 + wissen3_2013_2
gen wissen_verb_2013_6 = wissen1_2013_6 + wissen2_2013_6 + wissen3_2013_6
gen wissen_verb_2013_7 = wissen1_2013_7 + wissen2_2013_7 + wissen3_2013_7

lab var wissen_verb_2013_2 "Index: Political Knowledge, verbally 2013 (Wave 2)"
lab var wissen_verb_2013_6 "Index: Political Knowledge, verbally 2013 (Wave 6)"
lab var wissen_verb_2013_7 "Index: Political Knowledge, verbally 2013 (Wave 7)"

	
* Visual knowledge: waves 1, 3 & 7
gen wissen_vis_2013_1 = wissen5_2013_1 + wissen6_2013_1 + wissen7_2013_1 + wissen8_2013_1 + wissen9_2013_1 + wissen10_2013_1
gen wissen_vis_2013_3 = wissen5_2013_3 + wissen6_2013_3 + wissen7_2013_3 + wissen8_2013_3 + wissen9_2013_3 + wissen10_2013_3
gen wissen_vis_2013_7 = wissen5_2013_7 + wissen6_2013_7 + wissen7_2013_7 + wissen8_2013_7 + wissen9_2013_7 + wissen10_2013_7

lab var wissen_vis_2013_1 "Index: Political Knowledge, visually Variant 1 2013 (Wave 1)"
lab var wissen_vis_2013_3 "Index: Political Knowledge, visually Variant 1 2013(Wave 3)"
lab var wissen_vis_2013_7 "Index: Political Knowledge, visually Variant 1 2013(Wave 7)"

		
* Visual knowledge: waves 2, 4 & 6
gen wissen_vis_2013_2 = wissen11_2013_2 + wissen12_2013_2 + wissen13_2013_2 + wissen14_2013_2 + wissen15_2013_2 + wissen16_2013_2
gen wissen_vis_2013_4 = wissen11_2013_4 + wissen12_2013_4 + wissen13_2013_4 + wissen14_2013_4 + wissen15_2013_4 + wissen16_2013_4
gen wissen_vis_2013_6 = wissen11_2013_6 + wissen12_2013_6 + wissen13_2013_6 + wissen14_2013_6 + wissen15_2013_6 + wissen16_2013_6

lab var wissen_vis_2013_2 "Index: Political Knowledge, visually Variant 2 2013(Wave 2)"
lab var wissen_vis_2013_4 "Index: Political Knowledge, visually Variant 2 2013(Wave 4)"
lab var wissen_vis_2013_6 "Index: Political Knowledge, visually Variant 2 2013(Wave 6)"

	
	


**************************
*** other indicators
**************************

* intention to vote
foreach num of numlist 1/7 {
	capture recode kp`num'_170 (1 6=5 "certain to vote")(2=4)(3=3)(4=2) ///
			(5=1 "certain not to vote") (else=.), gen(itv_2013_`num')
	capture lab var itv_2013_`num' "Intention to Vote 2013 (Wave `num')"		
}


* difficulty to vote
foreach num of numlist 1/9 {
	capture recode kp`num'_330 (1=5 "very difficult")(2=4)(3=3)(4=2) ///
			(5=1 "not difficult at all")(else=.), gen(vote_diff_2013_`num')
	capture lab var vote_diff_2013_`num' "Difficulty of voting decision 2013 (Wave `num')"		
}

* use internet for political issues
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_1600, mv(-99/-1)
	capture gen inet_pol_2013_`num' =  kp`num'_1600 - 1
	capture lab var inet_pol_2013_`num' "Internet use in days per week, politically current 2013 (Wave `num')"		
}

* use print media for political issues
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_1661?, mv(-99/-1)
	capture gen print_pol_bild_2013_`num' =  kp`num'_1661a - 1
	capture gen print_pol_fr_2013_`num' =  kp`num'_1661b - 1
	capture gen print_pol_faz_2013_`num' =  kp`num'_1661c - 1
	capture gen print_pol_sz_2013_`num' =  kp`num'_1661d - 1
	capture gen print_pol_taz_2013_`num' =  kp`num'_1661e - 1
	capture gen print_pol_welt_2013_`num' =  kp`num'_1661f - 1
	capture gen print_pol_other_2013_`num' =  kp`num'_1661g - 1
	capture recode kp`num'_1661h (1=1 "did not read any" 2=0 "read articles"), gen(print_pol_no_2013_`num')
	
	capture lab var print_pol_bild_2013_`num' "Print media use (BILD), politically current 2013 (Wave `num')"		
	capture lab var print_pol_fr_2013_`num' "Print media use (Frank. Rund.), politically current 2013 (Wave `num')"		
	capture lab var print_pol_faz_2013_`num' "Print media use (FAZ), politically current 2013 (Wave `num')"		
	capture lab var print_pol_sz_2013_`num' "Print media use (SZ), politically current 2013 (Wave `num')"		
	capture lab var print_pol_taz_2013_`num' "Print media use (TAZ), politically current 2013 (Wave `num')"		
	capture lab var print_pol_welt_2013_`num' "Print media use (Welt), politically current 2013 (Wave `num')"		
	capture lab var print_pol_other_2013_`num' "Print media use (other), politically current 2013 (Wave `num')"		
	capture lab var print_pol_no_2013_`num' "Print media use (none), politically current 2013 (Wave `num')"		
}


* use tv for political issues
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_1681?, mv(-99/-1)
	capture gen tv_pol_ard_2013_`num' =  kp`num'_1681a - 1
	capture gen tv_pol_zdf_2013_`num' =  kp`num'_1681b - 1
	capture gen tv_pol_rtl_2013_`num' =  kp`num'_1681c - 1
	capture gen tv_pol_sat1_2013_`num' =  kp`num'_1681d - 1
	capture gen tv_pol_other_2013_`num' =  kp`num'_1681e - 1
	capture recode kp`num'_1681f (1=1 "did not watch any" 2=0 "watched news"), gen(tv_pol_no_2013_`num')
	
	capture lab var tv_pol_ard_2013_`num' "TV media use (ARD), politically current 2013 (Wave `num')"		
	capture lab var tv_pol_zdf_2013_`num' "TV media use (ZDF), politically current 2013 (Wave `num')"		
	capture lab var tv_pol_rtl_2013_`num' "TV media use (RTL), politically current 2013 (Wave `num')"		
	capture lab var tv_pol_sat1_2013_`num' "TV media use (Sat 1), politically current 2013 (Wave `num')"		
	capture lab var tv_pol_other_2013_`num' "TV media use (other, e.g. n-tv, Pro7), politically current 2013 (Wave `num')"		
	capture lab var tv_pol_no_2013_`num' "TV media use (none), politically current 2013 (Wave `num')"		
}




* importance of election outcome
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_380, mv(-99/-1)
	capture recode kp`num'_380 (1=5 "very important")(2=4)(3=3)(4=2)(5=1 "not important at all")(else=.), gen(imp_elec_2013_`num')	
	capture lab var imp_elec_2013_`num' "Interest in the outcome of the election 2013 (Wave `num')"		
}


* Interest, election campaign
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_390, mv(-99/-1)
	capture recode kp`num'_390 (1=5 "very important")(2=4)(3=3)(4=2)(5=1 "not important at all")(else=.), gen(imp_elec_camp_2013_`num')	
	capture lab var imp_elec_camp_2013_`num' "Interest, election campaign 2013 (Wave `num')"		
}


* Political Interest
foreach num of numlist 1/9 {
	capture mvdecode kp`num'_010, mv(-99/-1)
	capture recode kp`num'_010 (1=5 "very strong")(2=4)(3=3)(4=2)(5=1 "not at all")(else=.), gen(polint_2013_`num')	
	capture lab var polint_2013_`num' "Political Interest 2013 (Wave `num')"		
}



* Political Efficacy
foreach num of numlist 1/7 {
	capture mvdecode kp`num'_050a kp`num'_050e kp`num'_050h kp`num'_050k, mv(-99/-1)
	capture clonevar effint1_2013_`num' =  kp`num'_050h
	capture clonevar effint2_2013_`num' =  kp`num'_050k
	capture clonevar effex1_2013_`num' =  kp`num'_050a
	capture clonevar effex2_2013_`num' =  kp`num'_050e

	capture lab var effint1_2013_`num' "Efficacy, internal: I have the confidence to take active part in a pol. discussion 2013 (Wave `num')"		
	capture lab var effint2_2013_`num' "Efficacy, internal: I am perfectly able to understand and assess important pol. questions 2013 (Wave `num')"		
	capture lab var effex1_2013_`num' "Efficacy, external: Politicians care about what ordinary people think 2013 (Wave `num')"	
	capture lab var effex2_2013_`num' "Efficacy, external: Politicians try to get in close contact with the population 2013 (Wave `num')"		
}

* Party ID & Strength
foreach num of numlist 1 3 5 7  {
	capture recode kp`num'_2090a (1/801=1 "has PID")(808=0 "has no PID")(else=.), gen(partyid_2013_`num')
	capture gen pidstr_2013_`num' = .
	capture replace pidstr_2013_`num' = 0 if partyid_2013_`num'==0 | kp`num'_2100==99 | kp`num'_2100==100
	capture replace pidstr_2013_`num' = 1 if kp`num'_2100==5
	capture replace pidstr_2013_`num' = 2 if kp`num'_2100==4
	capture replace pidstr_2013_`num' = 3 if kp`num'_2100==3
	capture replace pidstr_2013_`num' = 4 if kp`num'_2100==2
	capture replace pidstr_2013_`num' = 5 if kp`num'_2100==1

	capture lab var partyid_2013_`num' "Has Party ID 2013 (Wave `num')"		
	capture lab var pidstr_2013_`num' "Party ID Strength 2013 (Wave `num')"		
}



*Voted: yes/no
recode kp7_180 (1 6=1 "yes")(2 -99=0 "no")(else=.), gen(vote_2013)
lab var vote_2013 "Voted in 2013"



*****************************************
*** Socio-Demographics
*****************************************

* East/West
recode ostwest (2=1 "East") (1=0 "West"), gen(east_2013)
clonevar east = east_2013

*Education
recode kpx_2320 (1 2=1 "low")(3=2 "medium")(4 5=3 "high")(9=.a "still student"), gen (edu_2013)
lab var edu_2013 "Education (3-cat)"
clonevar edu = edu_2013

*Age
gen age_2013=(2013-kpx_2290)
lab var age_2013 "Age"
clonevar age = age_2013

*Gender
recode kpx_2280 (1=0 "male")(2=1 "female"), gen(sex_2013)
lab var sex_2013 "Gender"
clonevar sex = sex_2013

*Unemployed
recode kpx_2340 (7=1 "unemployed")(-99 -97=.)(else=0 "not unemployed"), gen(unemployed_2013)
lab var unemployed_2013 "Unemployed"

*Not in labor force
recode kpx_2340 (3/6 10/12=1 "nlf")(-99 -97=.)(else=0 "in labor force"), gen(nlf_2013)
lab var unemployed_2013 "Not in labor force"

*Employment status
fre kpx_2340
mvdecode kpx_2340, mv(-99/-1)
clonevar empstat_2013 = kpx_2340
lab var empstat_2013 "Employment Status"

*Occupation
fre kpx_2380
mvdecode kpx_2380, mv(-99)
clonevar occupation_2013 = kpx_2380
lab var occupation_2013 "Occupation"

*Sector of the economy
fre kpx_3660
mvdecode kpx_3660, mv(-99)
clonevar sector_2013 = kpx_3660
lab var sector_2013 "Job: Sector of the Economy"

*HH size
recode kpx_2441 (-99=.), gen(hhsize_2013)

*Migration status
fre kpx_2541
recode kpx_3930 (-97 1=0 "no migrant")(-99 2/16=1 "migrant")(else=.), gen(migrant_2013)

clonevar test_2013 = kpx_3930

*****************************************
*** Save data
*****************************************
clonevar lfdn_2013 = lfdn

mvdecode lfdn09, mv(-97)
clonevar lfdn_2009 = lfdn09

gen year_2013 = 2013

keep year year_2013 wei* lfdn_2013 lfdn_2009 ewl_2013_1-sector_2013 hhsize_2013 migrant_2013 test_2013
drop kp* 

save "SET_YOUR_PATH_FOR_OUTPUT\GLES\wkp2013_short.dta", replace











